import * as actionTypes from './actionTypes';
import axios from 'axios';

// 获取banner数据
export const getRanks = () => {
  return (dispatch) => {
    axios.get('http://localhost:3000/toplist/detail').then(res => {
      console.log(res)
      const ranks = res.data.list
      const featureList = ranks.slice(0, 4)
      const globalList = ranks.slice(4, ranks.length)
      const action = {
        type: actionTypes.GET_RANKS,
        featureList,
        globalList
      }
      dispatch(action)
    })
  }
}